package matroska

import (
	"gitee.com/general252/ebml-go/core"
	"gitee.com/general252/ebml-go/webm"
	"time"
)

type trackSRT struct {
	UnimplementedTrack
}

func NewTrackSRT() Track {
	const CodecPrivateSize = 256
	t := &trackSRT{
		UnimplementedTrack: UnimplementedTrack{
			track: webm.TrackEntry{
				Name:         "Subtitle(srt)",
				TrackNumber:  1,
				TrackUID:     getTrackUID(),
				CodecID:      core.SubtitleCodecTEXTUTF8,
				TrackType:    core.TrackTypeSubtitle,
				CodecPrivate: make([]byte, 2),
				Void:         make([]byte, CodecPrivateSize-2),
			},
		},
	}

	return t
}

func (tis *trackSRT) WriteWithDuration(timestamp time.Duration, duration time.Duration, b []byte, keyframe ...bool) (int, error) {
	return tis.UnimplementedTrack.WriteWithDuration(timestamp, duration, b, false)
}
